<template>
  <div id="basicLayout">
    <a-layout style="min-height: 100vh">
      <a-layout-header :style="{ position: 'fixed', zIndex: 1, width: '100%' }" class="header">
        <GlobalHeader />
      </a-layout-header>

      <a-layout style="margin-top: 45px">
        <GlobalSider
          v-if="useLoginUserStore().loginUser.id"
          :style="{
            overflow: 'auto',
            height: '100vh',
            position: 'fixed',
          }"
          class="sider"
        />
        <a-layout-content class="content" :style="{marginLeft: marginLeft}">
          <router-view />
        </a-layout-content>
      </a-layout>

      <a-layout-footer class="footer"> 陈元照 1668687856</a-layout-footer>
    </a-layout>
  </div>
</template>

<script setup lang="ts">
import GlobalHeader from '@/components/GlobalHeader.vue'
import GlobalSider from '@/components/GlobalSider.vue'
import { useLoginUserStore } from '@/stores/useLoginUserStore.ts'
import { computed, onMounted, ref } from 'vue'

// 判断用户是否登录
const marginLeft = computed(() => {
  if (useLoginUserStore().loginUser.id) {
    return "200px"
  }
})


</script>

<style scoped>
#basicLayout .header {
  background-color: white;
  margin-bottom: 16px;
  padding-inline: 16px;
}

#basicLayout .content {
  padding: 20px;
  background: linear-gradient(to right, #efefef, #ffffff);
  margin-bottom: 48px;
}

#basicLayout .footer {
  background-color: #efefef;
  padding: 16px;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
}

#basicLayout .content {
  padding: 28px;
}

#basicLayout .sider {
  background: #fff;
  margin-top: 20px;
  border-right: 0.5px solid #eee;
}

#basicLayout :deep(.ant-menu-root) {
  border-bottom: none !important;
  border-inline-end: none !important;
}
</style>
